/* 一系列用于转换服务端奇葩数据为前端所需的数据格式的函数集合，便于统一管理 */

/**
 * 转换当前用户信息
 * 接口数据来源：/api/uc/org/employee/v1/info/get
 */
export function transformCurUserInfo(data = {}) {
    console.log('接口数据转换：/api/uc/org/employee/v1/info/get 源数据', data);

    const { firstOrgInfo, employeeCode: userCode } = data;
    const {
        firstCompanyCode: companyId = '',
        firstCompanyName: companyName = '',
        firstDepartmentCode: departmentId = '',
        firstDepartmentName: departmentName = ''
    } = firstOrgInfo;

    const final = { ...data, companyId, companyName, departmentId, departmentName, userCode };

    console.log('接口数据转换：/api/uc/org/employee/v1/info/get 转换后', final);

    return final;
}
